<template>
  <div>
    <p>你一共点了{{count}}次 count是 {{evenOrOdd}}</p>
    <button @click="increment">增加一</button>
    <button @click="decrement">减少一</button>
    <button @click="incrementIfEven">偶数加一</button>
    <button @click="incrementAsync">异步加一</button>
  </div>
</template>

<script>
  // import { mapMutations } from 'vuex'
  import { mapGetters, mapActions, mapState } from 'vuex'
  export default {
    name: 'Counter',
    methods: {
      ...mapActions([
        'increment',
        'decrement',
        'incrementAsync',
        'incrementIfEven'
      ])
    },
    computed: {
      ...mapState(['count']),
      ...mapGetters(['evenOrOdd'])
    }
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  h3 {
    margin: 40px 0 0;
  }
  ul {
    list-style-type: none;
    padding: 0;
  }
  li {
    display: inline-block;
    margin: 0 10px;
  }
  a {
    color: #42b983;
  }
</style>
